package com.ihr360.payroll.model.type;

/**
 * 薪资计算单批次内的分段计薪
 */
public enum SalaryPhase {
    //数字小的分度为距离当前时间最近的
    PHASE1("调整后"),
    PHASE2("调整前"),
    PHASE3("分段3"),
    PHASE4("分段4"),
    PHASE5("分段5"),
    NOT_SUPPORT("不支持的分段");
    private String title;

    SalaryPhase(String phase) {
        this.title = phase;
    }

    public String getTitle() {
        return title;
    }

    public static String toPhaseTitle(String phase){
        SalaryPhase salaryPhase = SalaryPhase.valueOf(phase);
        if (salaryPhase!=null){
            return salaryPhase.getTitle();
        }
        return NOT_SUPPORT.getTitle();
    }

    public static SalaryPhase  toPhase(int phase){
        switch (phase){
            case 0:
                return PHASE1;
            case 1:
                return PHASE2;
            case 2:
                return PHASE3;
            case 3:
                return PHASE4;
            case 4:
                return PHASE5;
        }
        return NOT_SUPPORT;
    }

}